package com.three.controller;

import com.three.aop.LogAnotation;
import com.three.entity.Keyboardcolor;
import com.three.service.KeyboardcolorService;
import com.three.vo.KeyboardVO;
import com.three.vo.KeyboardcolorVO;
import com.three.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/keyboardcolor")
public class KeyboardcolorController {
    @Autowired
    private KeyboardcolorService keyboardcolorService;
    @GetMapping("/list")
    public R list(){
        return keyboardcolorService.list();
    }
//展示所有和搜索框搜索
    @PostMapping("/keycolorlist")
    public R KeyboardcolorList(Integer pageNum, Integer pageSize, @RequestBody KeyboardcolorVO keyboardcolorVO)
    {
        return keyboardcolorService.selectKeyboardcolor(pageNum, pageSize, keyboardcolorVO);
    }

    //添加
    @PostMapping("/addkeyboardcolor")
    @LogAnotation(value = "添加键盘颜色")
    public R addKeyboardcolor(@RequestBody Keyboardcolor keyboardcolor)
    {
        return keyboardcolorService.addKeyboardcolor(keyboardcolor);
    }

    //删除
    @DeleteMapping("/delkeyboardcolor")
    @LogAnotation(value = "删除键盘颜色")
    public R deleteKeyboardcolor(Integer keyboardcolorid)
    {
        return keyboardcolorService.deleteKeyboardcolor(keyboardcolorid);
    }
    //修改
    @PutMapping("/editkeyboardcolor")
    @LogAnotation(value = "修改键盘颜色")
    public R editKeyboardcolor(@RequestBody Keyboardcolor keyboardcolor)
    {
        return keyboardcolorService.editKeyboardcolor(keyboardcolor);
    }
}
